from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.babel import Babel
import logging

app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
babel = Babel(app)

if app.debug or True:
	from logging.handlers import RotatingFileHandler
	filehandler = RotatingFileHandler('tmp/pygem.log', 'a', 1 * 1024 * 1024, 10)
	filehandler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
	app.logger.setLevel(logging.INFO)
	filehandler.setLevel(logging.INFO)
	app.logger.addHandler(filehandler)

	app.logger.info('pygem startup')


from app import models, views
